<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ghost Floating</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="shortcut icon" href="./youling0.png" type="image/x-icon">
    <style>
        /* 设计进入页面的样式 */
        .game-splash {
            text-align: center;
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;

            background-color: #000;
            
            color: #fff;
            
            font-family: Arial, sans-serif;
            max-width: 800px;
            height: 358px;
            position: relative;
            margin: 0 auto;
            padding-bottom: 50px;
        }
        .game-splash .game-contents {
            position: relative;
            top: 30%;
        }

        .progress-bar {
            width: 50%;
            height: 20px;
            background-color: #555;
            position: relative;
            margin: 0px auto;
        }

        .progress {
            height: 100%;
            background-color: #4CAF50;
            position: absolute;
            left: 0;
            width: 0%;
            /* 初始化进度为0 */
            transition: width 0.4s ease-in-out;
        }
    </style>
</head>

<body>
    <div class="game-splash">
        <div class="game-contents">
        <h1 style="color: aqua;font-family:Verdana, Geneva, Tahoma, sans-serif">Ghost Floating</h1>
        <p>加载中...</p>
        <div class="progress-bar">
            <div class="progress"></div>
        </div>
        </div>
    </div>
    <script>
        function simulateLoading(progressInterval, callback) {
            let progress = 0;
            const progressElement = document.querySelector('.progress');

            const interval = setInterval(() => {
                progress += 10;
                progressElement.style.width = progress + '%';

                if (progress >= 100) {
                    clearInterval(interval);
                    // 隐藏启动界面
                    document.querySelector('.game-splash').style.display = 'none';
                    // 执行回调函数，例如跳转到主界面
                    if (callback) {
                        callback();
                    }
                }
            }, progressInterval);
        }

        function redirectToMain() {
            window.location.href = 'start.html'; // 跳转页面
        }

        // 加载过程所需时间
        simulateLoading(100, redirectToMain);
    </script>
</body>

</html>